function initialize() {
          var mapOptions = {
            zoom: 15,
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            mapTypeControl: true,
            mapTypeControlOptions: {
                style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
                position: google.maps.ControlPosition.TOP_CENTER
            },  
            streetViewControl: true,
            streetViewControlOptions: {
                position: google.maps.ControlPosition.LEFT_CENTER
            },
            zoomControl: true,
            zoomControlOptions: {
                style: google.maps.ZoomControlStyle.LARGE,
                position: google.maps.ControlPosition.LEFT_CENTER
            },
            scaleControl: true,
            scaleControlOptions: {
                position: google.maps.ControlPosition.TOP_LEFT
            },
            panControl: false      
          };
          map = new google.maps.Map(document.getElementById('map-canvas'),
              mapOptions);
          setMyPosition();
          app.currentRoom.map=map;
}

function handleNoGeolocation() {
	app.currentRoom.map.setCenter(new google.maps.LatLng(-33.458, -70.662));
}

function listenerMarker(){
        google.maps.event.addListenerOnce(app.currentRoom.map, 'click', function(event) {
                app.currentRoom.addBlog(event.latLng.lb,event.latLng.mb);
        });
}

function setMyPosition(){
        if(navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {
              var pos = new google.maps.LatLng(position.coords.latitude,
                                               position.coords.longitude);
              if(app.user.myLocation==null)
            	  app.user.myLocation = new google.maps.Marker({
                            clickable: false,
                            position: pos,
                            icon: new google.maps.MarkerImage('//maps.gstatic.com/mapfiles/mobile/mobileimgs2.png',
                                                                            new google.maps.Size(22,22),
                                                                            new google.maps.Point(0,18),
                                                                            new google.maps.Point(11,11)),
                            shadow: null,
                            zIndex: 999,
                            map: map 
                        });
              else
            	  app.user.myLocation.setPosition(pos);
              app.currentRoom.map.setCenter(app.user.myLocation.getPosition());
            }, function() {
              handleNoGeolocation();
            });
          } else {
            // Browser/GPS doesn't support Geolocation
            handleNoGeolocation();
          }     
}
